/*
 * Copyright 2020-2025 the original author or authors.
 * You cannot use this file unless authorized by the author.
 */

package org.ipig.commons.conf.ehcache;

import org.ipig.constants.CacheCnst;
import lombok.Data;
import lombok.ToString;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * EhcacheConf
 *
 * @author <a href="mailto:comchnts@163.com">chinats</a>
 * @version $$Id: EhcacheConf.java 12 2020-04-15 11:35:15Z ts <comchnts@163.com> $$
 * @since 1.0
 */
@Data
@ToString
public class EhcacheConf implements Serializable {
    /**
     * 存储目录
     */
    private String rootDirectory;
    /**缓存别名*/
    private String cacheAlias;
    /**堆内存【单位MB】*/
    private int heapSize=32;
    /**堆外内存【单位MB】*/
    private int offHeapSize=256;
    /**磁盘大小【单位MB】 默认10G*/
    private int diskSize=10240;
    /**过期时间【单位秒】配置需要的Duration,默认时间为秒 默认一天 见cacheTimeSeconds*/
//    private int expirySeconds=86400;
    /**过期策略，默认TTI【支持TTL与TTI 参考CacheCnst.ExpiryPolicy】*/
    private String expiryPolicy= CacheCnst.ExpiryPolicy.TTI.code;
    /**本地磁盘是否持久化*/
    private boolean diskPersistable =false;
    //资源池是否可持久化 resourcePoolPersistable
    private boolean rsrcPoolPersistable=false;
    //来设置最大的对象大小,单位KB
    private long maxObjSize =1024;
    //统计对象大小时，对象图遍历深度
    private long maxObjGraph =1000;
    //使用预定义的生存时间，配置需要的Duration,默认时间为秒
//    private long ttlExpirationDurationOfSeconds=86400;
    //withDefaultSizeOfMaxObjectSize,单位KB
    private long dfltSizeOfMaxObjSize =1024;
    //withDefaultSizeOfMaxObjectGraph
    private long dfltSizeOfMaxObjGraph =1024;
    // 其它属性
    private Map<String, String> props = new HashMap<String, String>();
    //默认缓存条目为一百万
    private int cacheSize=1000000;
    /**过期时间【单位秒】配置需要的Duration,默认时间为秒 默认一天 */
    private int cacheTimeSeconds=86400;
}
